home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_mp1.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  288 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_MP1 Blaster.cog
  4. #
  5. # an all-purpose cog for the IMP#1 effect
  6. #
  7. # [CMG] (made generic by [RKD])
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13. #    MESSAGES
  14. message     startup
  15. message     activated
  16. message        damaged
  17. message        pulse
  18.  
  19. #    ACTORS
  20. thing    player        nolink    local
  21.  
  22. #    CAMERAS
  23. thing    saycam
  24. thing    cam1spot    local
  25. thing    cam1look    local
  26.  
  27. #    THINGS
  28. thing   bombpos    
  29. thing    fragment    local
  30. thing    dustthing    local
  31.  
  32. #    SURFACES
  33. surface        crackedwall        mask=0x408
  34.  
  35. #    MATERIALS
  36. material    dustmat=gen_a4sfx_dustcloud.mat        local
  37.  
  38. #    SOUND FX
  39. sound        explosion=shw_wall_crash.wav        local
  40. sound       sfxCharge=imp1_chargeup.wav         local
  41. sound        rumble=imp1_wall_break.wav            local
  42.  
  43. # ** voice lines **
  44. sound       inCrumble=Inxj025.wav        local   # ...ready to crumble.
  45. sound       inVibrate=Inxj026.wav        local   # A little vibration...
  46.  
  47. #    TEMPLATES
  48. template    debris=stoneshrapa_nc        local
  49. template    dust=dustcloud                local
  50.  
  51. #    VARIABLES
  52. int        i=0                       local
  53. int        locked=0            local
  54. int        curWeapon=0            local
  55. flex    shakecounter=0.1    local
  56.  
  57. #    SUBROUTINES
  58. flex    vibeline=0.0    local
  59. flex    fauxdamage=0.0    local
  60.  
  61. end
  62.  
  63. # ========================================================================================
  64. code
  65. startup:
  66.     player = GetLocalPlayerThing();
  67.     Sleep(.3);
  68.  
  69.     # make wall no-move, no-see, and visible
  70.     ClearAdjoinFlags(crackedwall, 0x2);
  71.     ClearAdjoinFlags(GetSurfaceAdjoin(crackedwall), 0x2);
  72.     ClearAdjoinFlags(crackedwall, 0x1);
  73.     ClearAdjoinFlags(GetSurfaceAdjoin(crackedwall), 0x1);
  74.     SetFaceGeoMode(crackedwall, 4);
  75.     SetFaceGeoMode(GetSurfaceAdjoin(crackedwall), 4);
  76.  
  77.     return;
  78.  
  79. # ========================================================================================
  80. activated:
  81. # ---> crackedwall    
  82.     if (GetSenderRef() != crackedwall) return;
  83.  
  84.     # FOR MARCUS TESTING PURPOSES
  85.     IF (INEDITOR())
  86.     {
  87.         CALL FAUXDAMAGE;
  88.         RETURN;
  89.     }
  90.     
  91.     # RT: No activations with anything but the lighter
  92.     curWeapon = GetCurWeapon(player);
  93.     if ((curWeapon != 0) && (curWeapon != 13))
  94.         return;
  95.  
  96.     call vibeLine;
  97.  
  98.     return;
  99.     
  100. # ========================================================================================
  101. damaged:
  102. # ---> crackedwall    
  103.  
  104.     # if cracked wall not damaged with IMP1 return
  105.     if (GetSenderRef() != crackedwall) return;
  106.     if (GetParam(1) != 0x1000) return;
  107.     
  108. fauxdamage:
  109. # ---> shortcut to get around "activation with IMP#1"
  110.  
  111.     if (locked) return;
  112.     
  113.     # do cutscene stuff
  114.     if (MakeMeStop() == -1) return;
  115.     StartCutscene(1);
  116.  
  117.     locked = 1;
  118.     
  119.     # make adjoins see-through
  120.     SetAdjoinFlags(crackedwall, 0x1);
  121.     SetAdjoinFlags(GetSurfaceAdjoin(crackedwall), 0x1);
  122.     
  123.     # setup offset camera
  124.     cam1spot = CreateThing(GetThingTemplate(saycam), saycam);
  125.     cam1look = CreateThing(GetThingTemplate(saycam), saycam);
  126.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  127.     SetCameraLookInterp(2, 0);
  128.     SetCameraPosInterp(2, 0);
  129.     SetCameraFocus(2, cam1spot);
  130.     SetCameraSecondaryFocus(2, cam1look);
  131.     SetCurrentCamera(2);
  132.     ResetCameraFOV(0, 0.0);
  133.     SetCameraLookInterp(2, 1);
  134.     SetCameraPosInterp(2, 1);
  135.     SetCameraInterpSpeed(2, 0.7);
  136.     Sleep(0.01);
  137.     SetCameraFocus(2, saycam);
  138.     SetCameraSecondaryFocus(2, bombpos);
  139.  
  140.     # start cameraShake
  141.     SetPulse(0.1);
  142.  
  143.     # alter fov for zoom-in effect
  144.     SetCameraFOV(70, 1, 2.5);
  145.  
  146.     # play sfx
  147.     PlaySoundLocal(sfxCharge, 1.0, 0.0, 0x0, 0);
  148.  
  149.     # light up the player
  150.     SetThingLight(bombpos, '0.25 0.55 1.0', 5.0, 2.0);
  151.     Sleep(1.5);
  152.     
  153.     # start up the rumble sound
  154.     PlaySoundLocal(rumble, 1.0, 0.0, 0x0, 0);
  155.     Sleep(1);
  156.  
  157.     # reset fov
  158.     SetCameraFOV(90, 0, 0.0);
  159.  
  160.     # kill dynamic light
  161.     SetThingLight(bombpos, '0.0 0.0 0.0', 5.0, 2.0);
  162.  
  163.     # play explosion sfx
  164.     PlaySoundLocal(explosion, 1, 0, 0x0, 0);
  165.  
  166.     # create the debris
  167.     for(i=0; i<8; i=i+1)                                                            
  168.     {
  169.         fragment = CreateThing(debris, bombpos);
  170.         SetThingVel(fragment, VectorScale(VectorAdd(RandVec(), '-0.5 -0.1 0.0'), 1));
  171.         SetThingRotVel(fragment, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 200.0));
  172.         Sleep(0.025);
  173.     }
  174.         
  175.     # alter adjoins
  176.     SetAdjoinFlags(crackedwall, 0x2);
  177.     SetAdjoinFlags(GetSurfaceAdjoin(crackedwall), 0x2);
  178.     SetFaceGeoMode(crackedwall, 0);
  179.     SetFaceGeoMode(GetSurfaceAdjoin(crackedwall), 0);
  180.  
  181.     # stop the screenshake
  182.     SetPulse(0);
  183.  
  184.     # create and animate the dust sprites
  185.     SetMaterialCel(dustmat, 0);
  186.     MaterialAnim(dustmat, 1.0, 1);
  187.     dustthing = CreateThing(dust, bombpos);
  188.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  189.     sleep(.3);
  190.     dustthing = CreateThing(dust, bombpos);
  191.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  192.     
  193.     # rest for a bit
  194.     Sleep(0.5);
  195.  
  196.     # restore camera and get rid of objects
  197.     SetCameraLookInterp(2, 0);
  198.     SetCameraPosInterp(2, 0);
  199.     SetCameraPosition(1, GetThingPos(saycam));
  200.     SetCurrentCamera(1);
  201.     DestroyThing(cam1spot);
  202.     DestroyThing(cam1look);
  203.  
  204.     # restore controls
  205.     RestoreExtCam();
  206.     EndCutscene();
  207.     ClearActorFlags(player, 0x200000);
  208.  
  209.     return;
  210.  
  211. # ========================================================================================
  212. vibeLine:
  213.     # prepare the player
  214.     if (MakeMeStop() == -1) return;
  215.     DeselectWeaponWait(player);
  216.  
  217.     StartCutscene(0);
  218.     
  219.     # setup offset camera
  220.     cam1spot = CreateThing(GetThingTemplate(saycam), saycam);
  221.     cam1look = CreateThing(GetThingTemplate(saycam), saycam);
  222.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  223.     SetCameraLookInterp(2, 0);
  224.     SetCameraPosInterp(2, 0);
  225.     SetCameraFocus(2, cam1spot);
  226.     SetCameraSecondaryFocus(2, cam1look);
  227.     SetCurrentCamera(2);
  228.     ResetCameraFOV(0, 0.0);
  229.     SetCameraLookInterp(2, 1);
  230.     SetCameraPosInterp(2, 1);
  231.     SetCameraInterpSpeed(2, 0.7);
  232.     Sleep(0.01);
  233.     SetCameraFocus(2, saycam);
  234.     SetCameraSecondaryFocus(2, bombpos);
  235.  
  236.     # say line shifts with every activation
  237.     Sleep(0.3);
  238.     if (i == 0)
  239.     {
  240.         PlayVoice(player, inVibrate, 1.0, 1);
  241.     }
  242.     else
  243.     {
  244.         PlayVoice(player, inCrumble, 1.0, 1);
  245.     }
  246.  
  247.     i = 1 - i;
  248.  
  249.     # restore camera and get rid of objects
  250.     SetCameraLookInterp(2, 0);
  251.     SetCameraPosInterp(2, 0);
  252.     SetCameraPosition(1, GetThingPos(saycam));
  253.     SetCurrentCamera(1);
  254.     DestroyThing(cam1spot);
  255.     DestroyThing(cam1look);
  256.  
  257.     # RT: Let the camera get back into position
  258.     Sleep(0.5);
  259.  
  260.     # return control
  261.     EndCutscene();
  262.     ClearActorFlags(player, 0x200000);
  263.  
  264.     return;
  265.  
  266. # ========================================================================================
  267. pulse:
  268.     
  269.     # shake increases over time
  270.     shakecounter = shakecounter + .2;
  271.     
  272.     SetPOVShake(VectorScale(VectorSet(RandBetween(-1, 1), RandBetween(-1, 1), RandBetween(-2, 2)), .005 * shakecounter),
  273.                 ' 0 0 0', .4, 50);
  274.     
  275.     return;
  276.  
  277. # ========================================================================================
  278.  
  279.  
  280. end
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.